package com.cloud.code.真题;

import java.util.Scanner;

/**
 * 小华是个很有对数字很敏感的小朋友
 */
public class Demo9 {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        while (scanner.hasNext()) {

            int n = scanner.nextInt();

            int number = 1;
            for (int i = 0; i < n; i++) {
                for (int j = 0; j < n - i - 1; j++) {
                    System.out.print(" ");
                }
                if (i % 2 != 0) {
                    int tem = number+i;
                    for (int j = 0; j <= i; j++) {
                        String s = chageNum(tem--);
                        System.out.print(s + " ");
                        number++;
                    }
                } else {
                    for (int j = 0; j <= i; j++) {
                        String s = chageNum(number);
                        System.out.print(s + " ");
                        number++;
                    }
                }
                System.out.println();
            }

        }
    }

    private static String chageNum(int number) {

        String tem = new String(number + "");
        for (int i = 0; i < 4 - String.valueOf(number).length(); i++) {
            tem = tem + "*";
        }

        return tem;
    }
}
